package com.sqlweb.sqlweb.base;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Slf4j
public class CatServiceTest {
    public static void main(String[] args) {
        int numThreads = 1; // 线程数量
        ExecutorService executorService = Executors.newFixedThreadPool(numThreads);
        CatService catService = new CatService();

        for (int i = 0; i < numThreads; i++) {
            final int index = i;
            executorService.submit(() -> {
                double currentTheta = Math.random(); // 随机生成 theta 值
                int[] respData = {-1, -1, -1, -1, -1, -1, -1, -1, -1}; // 示例响应数据
                String itemParPath = "E:/CAT/output.csv"; // 使用相同的文件路径
                int maxNI = 9;
                double maxSE = 0.316;

                log.info("Starting service execution in thread: " + Thread.currentThread().getName() + " with currentTheta: " + currentTheta);
                catService.executeService(currentTheta, respData, itemParPath, maxNI, maxSE);
            });
        }

        executorService.shutdown(); // 关闭线程池
    }
}
